<?php
//继承拥有比组合更少的代码
class car{
    public function addoil(){
        echo "Add Oil \r\n";
    }
}

class bmw extends car{

}


class benz{
    public $car;
    public function __construct()
    {
        $this->car = new car();
    }

    public function addoil(){
        $this->car->addoil();
    }
}

$bwm = new bmw;
$bwm->addoil();

$benz = new benz();
$benz->addoil();
